﻿
Imports System.Data
Imports VSModel
Imports Cls_Common
Partial Class FrontEnd_Control_Menu_MemberLeftMenu
    Inherits System.Web.UI.UserControl
    Public curStoreURL As String = ""

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            LoadMenu()
        End If
    End Sub
    Protected Sub LoadMenu()
        Dim lstNode As New DataSet
        lstNode.ReadXml(MapPath("../../../xml/MemberLeftMenu.xml"))
        With rptMenu
            .DataSource = lstNode.Tables("Node")
            .DataBind()
        End With
        'check if have store
        Using _data As New VSEntities
            Dim _UserId As Integer = Session("UserId")
            Dim check = (From q In _data.Stores Where q.UserId = _UserId Select q).FirstOrDefault
            If Not check Is Nothing Then
                ltrTrangWeb.Text = "<li> <a href='" & MainDomain & "thong-tin-ho-kinh-doanh.html'>Thông tin hộ kinh doanh</a>" & "</li>"
                If check.StatusId = 3 Then
                    ltrSanPham.Text = "<li> <a href='" & MainDomain & "quan-ly-san-pham.html'>Danh sách sản phẩm</a>" & "</li>"
                End If
            Else
                ltrTrangWeb.Text = "<li> <a href='" & MainDomain & "tao-moi-ho-kinh-doanh.html'> Tạo mời hộ kinh doanh</a>" & "</li>"
            End If

        End Using


    End Sub



    Protected Sub rptMenu_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptMenu.ItemDataBound


        Dim hplTitle As HyperLink = CType(e.Item.FindControl("hplTitle"), HyperLink)
        hplTitle.NavigateUrl = MainDomain & e.Item.DataItem("URL")
        hplTitle.Text = e.Item.DataItem("Title")



        'end bind menu

    End Sub

End Class
